﻿Imports Entities
Public Class GarantiasCambiadasDAL
    Public Shared Function Create(ByVal zObject As GarantiasCambiadas) As GarantiasCambiadas
        Try
            Using bd As New gas_gasdesuvecinoEntities
                bd.GarantiasCambiadas.Add(zObject)
                bd.SaveChanges()
                Return zObject
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function Delete(ByVal zVentaId As Long) As Boolean
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = From rec In bd.garantiascambiadas
                            Where rec.VENTA = zVentaId
                          Select rec

                bd.garantiascambiadas.Remove(query.Single)
                bd.SaveChanges()


                Return True
            End Using
        Catch ex As Exception
            Return False
        End Try
    End Function
    Public Shared Function List() As List(Of GarantiasCambiadas)
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Return bd.GarantiasCambiadas.ToList
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
End Class
